<template>
  <div>
    <!-- 单标签 -->
    <child2 />
    <hr />
    <button @click="clickFn">父组件调用子组件中的fn方法</button>
  </div>
</template>

<script>
import child2 from "./components/child2";
export default {
  data() {
    return {
      name: "张三",
    };
  },
  components: {
    child2,
  },
  methods: {
    clickFn() {
      // 得到一个子组件数组 父组件下面可能会有N多个子组件
      // console.log(this.$children);
      // console.log(this.$children[0]);
      this.$children[0].title = '父组件给你修改的'
      this.$children[0].fn()
    },
  },
};
</script>

<style lang='scss' scoped>
</style>